home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / plotting / imagetoo / imagetl1.lha / Imagetool / Makefile < prev    next >
Encoding:
Makefile  |  1990-09-20  |  11.4 KB  |  272 lines

  1. # ******************************************************************************
  2. # *                               NCSA ImageTool 1.1 beta
  3. # *                           19 September 1990    
  4. # * 
  5. # * NCSA ImageTool 1.1 beta source code and documentation are in the public
  6. # * domain.
  7. # * Specifically, we give to the public domain all rights for future licensing
  8. # * of the source code, all resale rights, and all publishing rights.
  9. # * 
  10. # * We ask, but do not require, that the following message be included in all
  11. # * derived works:
  12. # * 
  13. # * Portions developed at the National Center for Supercomputing Applications at
  14. # * the University of Illinois at Urbana-Champaign.
  15. # * 
  16. # * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  17. # * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  18. # * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  19. # * 
  20. # ******************************************************************************
  21. #
  22. # abstract:    Make file for creating and installing NCSA ImageTool 1.1
  23. #        beta. There are two make targets: personal and system.
  24. #        Repeated executions of this file are possible.
  25. # by:        NCSA Software Development Group
  26. # date:        Sep 90
  27. #
  28. # notes:     Typing 
  29. #
  30. #            make personal
  31. #
  32. #        will attempt to:
  33. #
  34. #        1. Create a working version of ImageTool, called
  35. #           imagetool, in this directory.
  36. #        2. Update (create) entries for SunView user defaults
  37. #           database in file $HOME/.defaults. See the macro list
  38. #           in the "Personal Installation" section below to change
  39. #           the value of default options. One should be able to
  40. #           produce a working version without changing anything
  41. #           provided you don't move any files around AND you have
  42. #           enough space AND you execute imagetool from this
  43. #           directory.
  44. #
  45. #        Typing
  46. #
  47. #            make system
  48. #
  49. #        will attempt to:
  50. #
  51. #        1. Create a working version of ImageTool, called
  52. #           imagetool, and move it and associated files to a
  53. #           system wide directory. See the macro list in the "System
  54. #           Installation" section below to set the appropriate
  55. #           directory.
  56. #        2. Add ImageTool.d to the master database files in
  57. #           directory /usr/lib/defaults. Check the macro list in
  58. #           "System Installation" section below to change the value
  59. #           of default options.
  60. #
  61. #        IMPORTANT:
  62. #        1. You must be root to "make system".
  63. #        2. After running "make system" each user of the system wide
  64. #           version MUST execute defaultsedit in SunView and save
  65. #           the ImageTool entries or set them to the system
  66. #           defaults. Otherwise, executing imagetool will fail with
  67. #           an error message.
  68. #        3. Run "make system" only on a standalone or server system.
  69. #
  70. #-------------------------------------------------------------------------------
  71. #
  72. # Installation independent macros:
  73. #
  74. # HDFDIR    -    HDF directory with header files relative to this
  75. #            makefile directory. DO NOT CHANGE!!!
  76. #
  77. HDFDIR = HDF
  78. HEADERS = headers
  79. SRCOBJ = src+obj
  80. #
  81. CC = cc
  82. CFLAGS = -O -I$(HEADERS) -I$(HDFDIR)
  83. CFLAGSX = -O -I../$(HEADERS) -I../$(HDFDIR)
  84. #
  85. #------------------------------------------------------------------------------
  86. #
  87. # Personal Intallation
  88. #
  89. # PCTMPDIR        - C compiler temporary directory. WATCH OUT!
  90. #              This may have to be changed to have enough space to
  91. #              compile successfully! Especially on a Sun-4.
  92. #              NEED
  93. #                ~1.2 MB (?)    - SunOS 4.x - Sun-3
  94. #                ~1.4 MB (?)    - SunOS 4.x - Sun386i
  95. #                ~8.0 MB (?)    - SunOS 4.x - Sun-4
  96. #
  97. PCTMPDIR = /tmp
  98. #
  99. # Values of defaults option macros for "make personal". These need not be
  100. # changed to check out a "personal" version. Go to the "System Installation"
  101. # section for the "system" version.
  102. #
  103. # PHelp_dir        - Directory containing the help files.
  104. # PPalette_file        - Initial palette file. Part of distribution.
  105. # PImage_dir        - Initial image directory. If it doesn't exit the
  106. #              current directory is used.
  107. # PFont_panel        - Sun provided screen font. DO NOT CHANGE!!!!
  108. # PFont_panel_button    - Sun provided screen font. DO NOT CHANGE!!!!
  109. # PFont_menu        - Sun provided screen font. DO NOT CHANGE!!!!
  110. # PMessage_limit        - Maximum number of messages saved in the "rolladex".
  111. # PBug_email_address    - Address to send bug messages to.
  112. #              
  113. PHelp_dir =        imagetool.help
  114. PPalette_file =        imagetool.pal
  115. PImage_dir =        samples
  116. PFont_panel =        /usr/lib/fonts/fixedwidthfonts/cour.b.14
  117. PFont_panel_button =    /usr/lib/fonts/fixedwidthfonts/cour.b.14
  118. PFont_menu =        /usr/lib/fonts/fixedwidthfonts/cour.b.18
  119. PMessage_limit =    20
  120. PBug_email_address =    martink@ncsa.uiuc.edu
  121. #
  122. personal:
  123.     @ echo ". . . build personal copy of software - this takes a few minutes"
  124.     @ echo ". . . . . . build HDF library"
  125.     @ (cd $(HDFDIR); make)
  126.     @ echo ". . . . . . build imagetool executable"
  127.     @ if [ -f $(SRCOBJ)/main.c ];  then mv $(SRCOBJ)/main.c .; fi
  128.     @ (cd $(SRCOBJ); for i in *.c; \
  129.        do \
  130.         $(CC) -c $(CFLAGSX) -temp=$(PCTMPDIR) $$i; \
  131.        done)
  132.     @ $(CC) -o imagetool $(CFLAGS) -temp=$(PCTMPDIR) main.c $(SRCOBJ)/*.o $(HDFDIR)/libdf.a -lsuntool -lsunwindow -lpixrect -lm
  133.     @ if [ -f main.c ]; then mv main.* $(SRCOBJ); fi
  134.     @ echo ". . . update $$HOME/.defaults"
  135.     @ if [ -f $$HOME/.defaults ]; then exit; \
  136.         else echo "SunDefaults_Version 2" > $$HOME/.defaults; exit; fi
  137.     @ awk '/^\/ImageTool/ { next } {print} \
  138.          END { \
  139.     print "/ImageTool/Help_dir\t\"$(PHelp_dir)\""; \
  140.     print "/ImageTool/Palette_file\t\"$(PPalette_file)\""; \
  141.     print "/ImageTool/Image_dir\t\"$(PImage_dir)\""; \
  142.     print "/ImageTool/Font_panel\t\"$(PFont_panel)\""; \
  143.     print "/ImageTool/Font_panel_button\t\"$(PFont_panel_button)\""; \
  144.     print "/ImageTool/Font_menu\t\"$(PFont_menu)\""; \
  145.     print "/ImageTool/Message_limit\t\"$(PMessage_limit)\""; \
  146.     print "/ImageTool/Bug_email_address\t\"$(PBug_email_address)\""; }' $$HOME/.defaults > .defaults
  147.     @ cp .defaults $$HOME/.defaults
  148.     @ echo ". . . cleanup files"
  149.     @ rm .defaults
  150.     @ echo ". . . done"
  151. #
  152. #------------------------------------------------------------------------------
  153. # System Installation
  154. #
  155. # SCTMPDIR        - C compiler temporary directory. WATCH OUT!
  156. #              This may have to be changed to have enough space to
  157. #              compile successfully! Especially on a Sun-4.
  158. #              NEED
  159. #                ~1.2 MB (?)    - SunOS 4.x - Sun-3
  160. #                ~1.4 MB (?)    - SunOS 4.x - Sun386i
  161. #                ~8.0 MB (?)    - SunOS 4.x - Sun-4
  162. #              Must be physically on the system you will be
  163. #              installing on. It must already exist!
  164. # TMPDIR        - System temporary directory. WATCH OUT! This may
  165. #              have to be changed to have enough space to create
  166. #              the distribution. It must already exist!
  167. #              NEED
  168. #                  ~1.0 MB (?) - SunOS 4.x
  169. #              Must be physically on the system you will be
  170. #              installing on.
  171. # SYSTEMDIR        - System wide directory where ImageTool and 
  172. #              associated files will be put. WATCH OUT! You
  173. #              MUST provide this value!
  174. #              NEED
  175. #                ~.3 MB (?) - SunOS 4.x
  176. #              Must be physically on the system you will be
  177. #              installing on. It must already exist!
  178. #              
  179. SCTMPDIR = /tmp
  180. TMPDIR = /tmp
  181. SYSTEMDIR = ?
  182. #
  183. # Values of defaults option macros for "make system".
  184. #
  185. # Help_dir        - Directory containing the help files. Put in system
  186. #              wide directory.
  187. # Palette_file        - Initial palette file. Part of distribution. Put in
  188. #              system wide directory.
  189. # Image_dir        - Initial image directory. If it doesn't exit the
  190. #              current directory is used.
  191. # Font_panel        - Sun provided screen font. DO NOT CHANGE!!!!
  192. # Font_panel_button    - Sun provided screen font. DO NOT CHANGE!!!!
  193. # Font_menu        - Sun provided screen font. DO NOT CHANGE!!!!
  194. # Message_limit        - Maximum number of messages saved in the "rolladex".
  195. # Bug_email_address    - Address to send bug messages to.
  196. #              
  197. Help_dir =        $(SYSTEMDIR)/imagetool.help
  198. Palette_file =        $(SYSTEMDIR)/imagetool.pal
  199. Image_dir =        /usr/local/samples
  200. Font_panel =        /usr/lib/fonts/fixedwidthfonts/cour.b.14
  201. Font_panel_button =    /usr/lib/fonts/fixedwidthfonts/cour.b.14
  202. Font_menu =        /usr/lib/fonts/fixedwidthfonts/cour.b.18
  203. Message_limit =        20
  204. Bug_email_address =    bugs@ncsa.uiuc.edu
  205. #
  206. system:
  207.     @ id | awk 'BEGIN {FS = "("} { if ( $$1 != "uid=0") \
  208.         { print "Must be root to install system. Make terminated!"; exit -1} }'
  209.     @ echo ". . . build system copy of software - this takes a few minutes"
  210.     @ echo ". . . . . . build HDF library"
  211.     @ rm -rf $(TMPDIR)/imagetool 1>/dev/null 2>&1
  212.     @ mkdir $(TMPDIR)/imagetool
  213.     @ cp -r $(HDFDIR) $(TMPDIR)/imagetool
  214.     @ (cd $(TMPDIR)/imagetool/$(HDFDIR); rm -f *.o *.a) 1>/dev/null 2>&1
  215.     @ (cd $(TMPDIR)/imagetool/$(HDFDIR); make)
  216.     @ echo ". . . . . . build imagetool executable"
  217.     @ cp -r $(SRCOBJ) $(TMPDIR)/imagetool
  218.     @ cp -r $(HEADERS) $(TMPDIR)/imagetool
  219.     @ (cd $(TMPDIR)/imagetool; mv $(SRCOBJ)/main.c .)
  220.     @ (cd $(TMPDIR)/imagetool/$(SRCOBJ); for i in *.c; \
  221.        do \
  222.         $(CC) -c $(CFLAGSX) -temp=$(SCTMPDIR) $$i; \
  223.        done)
  224.     @ (cd $(TMPDIR)/imagetool; $(CC) -o imagetool $(CFLAGS) -temp=$(SCTMPDIR) main.c $(SRCOBJ)/*.o $(HDFDIR)/libdf.a -lsuntool -lsunwindow -lpixrect -lm)
  225.     @ (cd $(TMPDIR)/imagetool; mv main.* $(SRCOBJ))
  226.     @ echo ". . . install files"
  227.     @ if [ -d $(SYSTEMDIR) ]; then exit; \
  228.         else echo "No such system wide directory (SYSTEMDIR=$(SYSTEMDIR)). Make terminated!"; exit 1 ; fi
  229.     @ install -d -g bin -m 0775 -o root $(SYSTEMDIR)/imagetool.help
  230.     @ install -g bin -m 0664 -o root imagetool.help/imagetool* $(SYSTEMDIR)/imagetool.help
  231.     @ install -g bin -m 0644 -o root imagetool.pal $(SYSTEMDIR)
  232.     @ install -g bin -m 0755 -o root $(TMPDIR)/imagetool/imagetool $(SYSTEMDIR)
  233.     @ echo ". . . update Master Database defaults file"
  234.     @ awk ' { m = 0 }\
  235.        /^\/\/Help_dir[ \t]/, /^    \$$Help/ { \
  236.         if ( n == 0 ) { print $$1 "\t\t\"$(Help_dir)\""; n++; } \
  237.         else if ( n == 1 ) { print; n++ } \
  238.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Help_dir)\""; n = 0 }; m = 1} \
  239.        /^\/\/Palette_file[ \t]/, /^    \$$Help/ { \
  240.         if ( n == 0 ) { print $$1 "\t\t\"$(Palette_file)\""; n++; } \
  241.         else if ( n == 1 ) { print; n++ } \
  242.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Palette_file)\""; n = 0 }; m = 1} \
  243.        /^\/\/Image_dir[ \t]/, /^    \$$Help/ { \
  244.         if ( n == 0 ) { print $$1 "\t\t\"$(Image_dir)\""; n++; } \
  245.         else if ( n == 1 ) { print; n++ } \
  246.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Image_dir)\""; n = 0 }; m = 1} \
  247.        /^\/\/Font_panel[ \t]/, /^    \$$Help/ { \
  248.         if ( n == 0 ) { print $$1 "\t\t\"$(Font_panel)\""; n++; } \
  249.         else if ( n == 1 ) { print; n++ } \
  250.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Font_panel) - DO NOT CHANGE!\""; n = 0 }; m = 1} \
  251.        /^\/\/Font_panel_button[ \t]/, /^    \$$Help/ { \
  252.         if ( n == 0 ) { print $$1 "\t\"$(Font_panel_button)\""; n++; } \
  253.         else if ( n == 1 ) { print; n++ } \
  254.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Font_panel_button) - DO NOT CHANGE!\""; n = 0 }; m = 1} \
  255.        /^\/\/Font_menu[ \t]/, /^    \$$Help/ { \
  256.         if ( n == 0 ) { print $$1 "\t\t\"$(Font_menu)\""; n++; } \
  257.         else if ( n == 1 ) { print; n++ } \
  258.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Font_menu)\""; n = 0 }; m = 1} \
  259.        /^\/\/Message_limit[ \t]/, /^    \$$Help/ { \
  260.         if ( n == 0 ) { print $$1 "\t\t\"$(Message_limit)\""; n++; } \
  261.         else if ( n == 1 ) { print; n++ } \
  262.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Message_limit). Valid range is in the interval [3, 100].\""; n = 0 }; m = 1} \
  263.        /^\/\/Bug_email_address/, /^    \$$Help/ { \
  264.         if ( n == 0 ) { print $$1 "\t\t\"$(Bug_email_address)\""; n++; } \
  265.         else if ( n == 1 ) { print; n++ } \
  266.         else if ( n == 2 ) { print "\t" $$1 "\t\t\"DEFAULT = $(Bug_email_address) - use local equivalent\""; n = 0 }; m = 1} \
  267.           { if ( m == 0) print }' ImageTool.d > $(TMPDIR)/imagetool/ImageTool.d
  268.     @ cp $(TMPDIR)/imagetool/ImageTool.d /usr/lib/defaults/ImageTool.d
  269.     @ echo ". . . cleanup files"
  270.     @ rm -r $(TMPDIR)/imagetool
  271.     @ echo ". . . done"
  272.